package com.tm.chargecar.controller;

import com.tm.chargecar.entity.AreaEntity;
import com.tm.chargecar.result.Result;
import com.tm.chargecar.service.AreaService;
import com.tm.chargecar.vo.AreaVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author wangSang
 * @create 2022-08-24 14:50
 *
 *  站点管理-片区管理
 */
@RequestMapping("area")
@RestController
public class AreaController {


    @Autowired
    private AreaService areaService;

    /**
     *   站点管理-片区管理
     * @return
     */
    @GetMapping("queryArea")
    public Result quertyArea(AreaVo areaVo){


        return areaService.quertyArea(areaVo);
    }

    /**
     * 新增片区
     * @return
     */
    @PostMapping("addArea")
    public Result addArea(@RequestBody AreaEntity areaEntity){

        return areaService.addArea(areaEntity);
    }

    /***
     * 修改片区负责人
     */
    @PutMapping("updateArea")
    public Result updateArea(@RequestBody AreaEntity areaEntity){


        return areaService.updateArea(areaEntity);
    }
    @DeleteMapping("deleteArea/{id}")
    public  Result deleteArea(@PathVariable Integer id){


        return areaService.deleteArea(id);
    }


}
